﻿@model List<DTOs.ProductDTO> 

@{
    ViewBag.Title = "List";
}


<div id="test">
<p> test</p>
</div>

<table>



@foreach (var item in Model)
{ 
    <tr>
    <td>
    @item.Name
    </td>

    <td>
    @item.Price
    </td>

    <td>
    @using (Ajax.BeginForm("AddtoCart", "ShoppingCart", new AjaxOptions() { UpdateTargetId = "addToCart", InsertionMode = InsertionMode.Replace, HttpMethod = "post" }))
    {
    <input type="hidden" name="productId" value = "@item.ProductId" />
    <input type="hidden" name="quantity" value = "1" />
        
    <input type="submit"  value="add to cart"/>
    }
@*    
     @Ajax.BeginForm("AddtoCart",new AjaxOptions() {})
{
    <input type="hidden" name="productId" value = "@item.ProductId" />
    <input type="button"  value="add to cart"/>
}*@

    </td>
    
  </tr>  

}
</table>
